# grytole@gmail.com 28-Jun-2012

export TOPDIR = $(shell pwd)

CC = gcc

TARGET_FILE = sdlua

LOCAL_LFLAGS = -L$(TOPDIR)/app -lapp -L$(TOPDIR)/lua -llua
GLOBAL_LFLAGS = -lm -lSDL -lSDL_ttf -lSDL_image

all: compile link

compile:
	@echo ""
	@echo "Compiling..."
	@echo "----------------------------------------"
	$(MAKE) -C $(TOPDIR)/lua all
	@echo "----------------------------------------"
	$(MAKE) -C $(TOPDIR)/app all
	@echo "----------------------------------------"
	@echo "Compile done"
	@echo ""

link:
	@echo ""
	@echo "Linking..."
	@echo "----------------------------------------"
	$(CC) $(LOCAL_LFLAGS) $(GLOBAL_LFLAGS) -o $(TARGET_FILE)
	@echo "----------------------------------------"
	@echo "Link done"
	@echo ""

clean:
	@echo ""
	@echo "Cleaning..."
	@echo "----------------------------------------"
	$(MAKE) -C $(TOPDIR)/lua clean
	@echo "----------------------------------------"
	$(MAKE) -C $(TOPDIR)/app clean
	@echo "----------------------------------------"
	@echo "Clean done"
	@echo ""

# eof
